<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ubb="http://java.sun.com/jsf/composite/components">

    <p:dataTable value="#{inactiveUserManager.inactiveUsers}" var="userItem" emptyMessage="#{msg['adminPage.userManagement.inactiveUsers.emptyTable']}..."
                 filteredValue="#{inactiveUserManager.filteredInactiveUsers}" rendered="#{administrationView.activePanel == 'ACTIVATE_NEW_USERS'}" styleClass="inactiveUsers">
        <p:columnGroup type="header">
            <p:row>
                <p:column>
                    <f:facet name="header">
                        <p:selectBooleanCheckbox id="selectAll" value="#{inactiveUserManager.selectAllBox}"
                                                 onchange="if ($(this).is(':checked')) {$('.selectAllAction').click()} else {$('.deselectAllAction').click()}" />
                    </f:facet>
                </p:column>
                <p:column headerText="#{msg['adminPage.userManagement.users.username']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.registrationDate']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.firstName']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.lastName']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.sex']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.age']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.email']}" />
                <p:column headerText="#{msg['adminPage.userManagement.users.group']}" />
            </p:row>
            <p:row>
                <p:column style="background:transparent" />
                <p:column filterBy="#{userItem.user.username}" filterMatchMode="contains" />
                <p:column style="background:transparent" />
                <p:column filterBy="#{userItem.user.firstname}" filterMatchMode="contains" />
                <p:column filterBy="#{userItem.user.lastname}" filterMatchMode="contains" />
                <p:column filterBy="#{userItem.user.sex}" filterMatchMode="exact" filterOptions="#{userManager.sexFilterOptions}" />
                <p:column filterBy="#{userItem.user.age}" filterMatchMode="contains" />
                <p:column filterBy="#{userItem.user.email}" filterMatchMode="contains" />
                <p:column filterBy="#{userItem.user.group.groupName}" filterMatchMode="contains" />
            </p:row>
        </p:columnGroup>
        <p:column>
            <p:selectBooleanCheckbox value="#{userItem.checked}" />
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.username}" />
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.registrationDate}" />
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.firstname}"/>
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.lastname}"/>
        </p:column>
        <p:column>
            <h:outputText value="#{msg['adminPage.userManagement.users.sex.male']}" rendered="#{userItem.user.sex}"/>
            <h:outputText value="#{msg['adminPage.userManagement.users.sex.female']}" rendered="#{!userItem.user.sex}"/>
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.age}"/>
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.email}"/>
        </p:column>
        <p:column>
            <h:outputText value="#{userItem.user.group.groupName}"/>
        </p:column>
    </p:dataTable>
    <h:panelGroup rendered="#{administrationView.activePanel == 'ACTIVATE_NEW_USERS'}" layout="block" styleClass="buttonPanel">
        <p:commandButton value="#{msg['adminPage.userManagement.inactiveUsers.activate']}" action="#{inactiveUserManager.activate}"
                         rendered="#{!inactiveUserManager.statusSwitch}" update="@form" icon="activate" />
        <ubb:confirmationButton value="#{msg['adminPage.userManagement.inactiveUsers.deactivate']}" action="#{inactiveUserManager.deactivate}" update="@form"
                                render="#{inactiveUserManager.statusSwitch}" confirmDialogWidgetVar="confirmDeactivation" icon="deactivate"
                                confirmDialogTitle="#{msg['adminPage.userManagement.inactiveUsers.deactivate.confirmationTitle']}"
                                confirmDialogMessage="#{msg['adminPage.userManagement.inactiveUsers.deactivate.confirmationMessage']}" />
        <p:commandButton value="#{msg['Common.cancel']}" action="#{administrationView.switchPanel('DESCRIPTION')}" update="@form" icon="cancel" process="@this" />
        <h:panelGroup layout="block" styleClass="activeInactiveSwitch">
            <h:outputText value="#{msg['adminPage.userManagement.inactiveUsers.statusSwitch.label']}: " />
            <p:commandButton value="#{msg['adminPage.userManagement.inactiveUsers.statusSwitch.active']}" action="#{inactiveUserManager.switchState(true)}"
                             styleClass="active#{!inactiveUserManager.statusSwitch ? ' off' : ''}" update="@form" />
            <p:commandButton value="#{msg['adminPage.userManagement.inactiveUsers.statusSwitch.inactive']}" action="#{inactiveUserManager.switchState(false)}"
                             styleClass="inactive#{inactiveUserManager.statusSwitch ? ' off' : ''}" update="@form" />
        </h:panelGroup>
        <p:commandButton style="display: none" styleClass="selectAllAction" process="@this" action="#{inactiveUserManager.selectAll(true)}" update="@form" />
        <p:commandButton style="display: none" styleClass="deselectAllAction" process="@this" action="#{inactiveUserManager.selectAll(false)}" update="@form" />
    </h:panelGroup>
</ui:composition>